home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club (Business) 1997 July / Software of the Month Club - Business (Volume 239) (July 1997).iso / pc / code / d.dxr / 00012_horn Code.ls < prev    next >
Encoding:
Text File  |  1996-02-15  |  1.5 KB  |  43 lines

  1. global HARP, TIGO, HORN, DRUM, CHIME, BASS, sPALETTE, gObjects, gOBJECTSD, gWorld, gPuppetlines, sQTCharSprite, gNextEnvLetter, gMIDIPlayTRUE, gInitalized, noteObjs, windowsMIDIXObj, xNAVXOBJ, xCURXOBJ, gCPU, gFileSep, gRootPath, gHDpath, gXobjs, gXOBJPath, gCDpath, gCDName
  2.  
  3. on MakehornChaotic RefNum
  4.   set OBj to getaProp(gObjects, RefNum)
  5.   playSound(getaProp(OBj, #sound), #cast)
  6.   repeat with NUM = 1 to count(getaProp(getaProp(OBj, #cast), #UP))
  7.     set the castNum of sprite getaProp(OBj, #SpriteNum) to getAt(getaProp(getaProp(OBj, #cast), #UP), NUM)
  8.     updateStage()
  9.   end repeat
  10.   repeat with NUM = count(getaProp(getaProp(OBj, #cast), #UP)) down to 1
  11.     set the castNum of sprite getaProp(OBj, #SpriteNum) to getAt(getaProp(getaProp(OBj, #cast), #UP), NUM)
  12.     updateStage()
  13.   end repeat
  14.   ChangeSpecialState(#HORN, #Chaotic)
  15.   eraseRecording(#HORN)
  16. end
  17.  
  18. on playHorn RefNum
  19.   if getaProp(getaProp(gObjects, #HORN), #State) = #nonChaotic then
  20.     playNonChaoticHorn(RefNum)
  21.   else
  22.     playChaoticHorn(RefNum)
  23.   end if
  24. end
  25.  
  26. on playNonChaoticHorn RefNum
  27.   set OBj to getaProp(gObjects, RefNum)
  28.   set HoleNum to getaProp(OBj, #HoleNum)
  29.   set halfTone to indexedNoteInInstrumentScale(HORN, 8 - HoleNum)
  30.   set note to 60 + halfTone - 1
  31.   noteOn(#HORN, note, 127)
  32.   repeat while the mouseDown
  33.     CursorandUpdate()
  34.   end repeat
  35.   noteOff(#HORN, note)
  36. end
  37.  
  38. on playChaoticHorn RefNum
  39.   set OBj to getaProp(gObjects, RefNum)
  40.   set HoleNum to getaProp(OBj, #HoleNum)
  41.   PlayNoteFromHitMap(#HORN)
  42. end
  43.